public class SameTree {//leecode 100

    public boolean isSameTree(TreeNode p, TreeNode q) {
        if(p==q)return true;
        if(p==null||q==null){
            return false;
        }
        if(p.val!=q.val){
            return false;
        }else{
            boolean left=isSameTree(p.left,q.left);
            boolean right=isSameTree(p.right,q.right);
            if(left==true&&right==true){
                return true;
            }else{
                return false;
            }

        }

    }
